<?
/**
 * List Source Ids
 */
(basename($_SERVER['PHP_SELF']) == basename(__FILE__)) && die('Access Denied');

// get phpdbo object
$dbo =& $this->getVar('list');

// what is the id property?
$idProp   = $dbo->getIdProperty();

// did search yield results?
$hasResults = (is_array($this->searchResults) and count($this->searchResults));

// Are there errors?
$hasErrors = (is_array($this->getErrors()) and count($this->getErrors()));

// query strings used below
$view_qs = $this->getActionQs(ACTION_VIEW, 0);

// initialize tr class
$class = '';
$this->addCss('css/print.css');
$this->addJs('js/menu.js');
?>
<?= $this->getPageHeader(); ?>
<? if ($hasErrors) { ?>
<div id="container-error">
<?= implode('<br />', $this->getErrors()); ?>
</div>
<? } ?>
<div align="center">
<div id="page-container">

<div id="container-medium">
<?= getMenuBars(OPT_LIST); ?>
</div> <!-- container-medium -->

<div id="container-large">
<div class="content-list">
<?= $this->getFormListSearch($dbo); ?>
<table cellpadding="1" cellspacing="1">
<? if ($hasResults) { ?>
<?= $this->getListSortableHeader($dbo, true); ?>
<?
foreach($this->searchResults as &$row) {
	$class = ($class == 'row1') ? 'row2' : 'row1';
	$id = (isset($row[$idProp])) ? $row[$idProp] : false;
	$oc = 'onClick=\'javascript:document.location.href="' . $view_qs . $id . '"\'';
?>
	<tr class="<?= $class; ?>" <?= $oc; ?>>
<? foreach($row as $prop => &$val) {
	//if ($prop == $idProp) { continue; } ?>
		<TD><?= htmlspecialchars($val); ?></TD>
<?	} ?>
	</TR>
<?	}
}
?>
</TABLE>
</div> <!-- content-list -->

<div id="container-pager">
<?= $this->getListPager(); ?>
</div> <!-- container-pager -->

</div> <!-- container-large -->
</div> <!-- page-container -->
</div> <!-- center -->
<script type="text/javascript">
doMenuMsg('<?= OPT_LIST; ?>');
document.search_form.inputLast.focus();
</script>
<?= $this->getPageFooter(); ?>
